﻿//////////////////////////////////////////////////////////////////////////
// FileName:
// CreateBy:
// CreateDate:2010-6-20
// Description:
//		SubDivision class
//
// Modify Log:
//
// Copyright:
/////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Auto.Components;

namespace Auto.Data.Systems.Model
{
    /// <summary>
    /// Description: 子部门
    /// </summary>
    [Serializable]
    public class SubDivision
    {
        #region --Field--
        ///<summary>
        ///Data Table _SubDivision
        ///</summary>
        public const string TABLENAME_SubDivision = "_SubDivision";
        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public const string FIELD_RecID = "RecID";
        /// <sumary> 
        /// (DivID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_DivID = "DivID";
        /// <sumary> 
        /// (SubDivID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_SubDivID = "SubDivID";
        /// <sumary> 
        /// (ShortDivName Type:NVarChar Len:20) 
        /// </sumary> 
        public const string FIELD_ShortDivName = "ShortDivName";
        /// <sumary> 
        /// (DivName Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_DivName = "DivName";
        /// <sumary> 
        /// (ParentID Type:VarChar Len:20) 
        /// </sumary> 
        public const string FIELD_ParentID = "ParentID";
        /// <sumary> 
        /// (Path Type:VarChar Len:200) 
        /// </sumary> 
        public const string FIELD_Path = "Path";
        /// <sumary> 
        /// (Title Type:NVarChar Len:100) 
        /// </sumary> 
        public const string FIELD_Title = "Title";
        /// <sumary> 
        /// (Email Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_Email = "Email";
        /// <sumary> 
        /// (Phone Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_Phone = "Phone";
        /// <sumary> 
        /// (Contact Type:NVarChar Len:50) 
        /// </sumary> 
        public const string FIELD_Contact = "Contact";
        #endregion --Field--

        #region --Property--
        private int _recid;
        private string _divid;
        private string _subdivid;
        private string _shortdivname;
        private string _divname;
        private string _parentid;
        private string _path;
        private string _title;
        private string _email;
        private string _phone;
        private string _contact;

        /// <sumary> 
        /// (RecID Type:Int Len:0) 
        /// </sumary> 
        public int RecID
        {
            set { _recid = value; }
            get { return _recid; }
        }

        /// <sumary> 
        /// (DivID Type:VarChar Len:20) 
        /// </sumary> 
        public string DivID
        {
            set { _divid = value; }
            get { return _divid; }
        }

        /// <sumary> 
        /// (SubDivID Type:VarChar Len:20) 
        /// </sumary> 
        public string SubDivID
        {
            set { _subdivid = value; }
            get { return _subdivid; }
        }

        /// <sumary> 
        /// (ShortDivName Type:NVarChar Len:20) 
        /// </sumary> 
        public string ShortDivName
        {
            set { _shortdivname = value; }
            get { return _shortdivname; }
        }

        /// <sumary> 
        /// (DivName Type:NVarChar Len:100) 
        /// </sumary> 
        public string DivName
        {
            set { _divname = value; }
            get { return _divname; }
        }

        /// <sumary> 
        /// (ParentID Type:VarChar Len:20) 
        /// </sumary> 
        public string ParentID
        {
            set { _parentid = value; }
            get { return _parentid; }
        }

        /// <sumary> 
        /// (Path Type:VarChar Len:200) 
        /// </sumary> 
        public string Path
        {
            set { _path = value; }
            get { return _path; }
        }

        /// <sumary> 
        /// (Title Type:NVarChar Len:100) 
        /// </sumary> 
        public string Title
        {
            set { _title = value; }
            get { return _title; }
        }

        /// <sumary> 
        /// (Email Type:NVarChar Len:50) 
        /// </sumary> 
        public string Email
        {
            set { _email = value; }
            get { return _email; }
        }

        /// <sumary> 
        /// (Phone Type:NVarChar Len:50) 
        /// </sumary> 
        public string Phone
        {
            set { _phone = value; }
            get { return _phone; }
        }

        /// <sumary> 
        /// (Contact Type:NVarChar Len:50) 
        /// </sumary> 
        public string Contact
        {
            set { _contact = value; }
            get { return _contact; }
        }

        #endregion --Property--

        #region --New--
        /// <summary>
        /// Constructed Function
        /// </summary>
        public SubDivision()
        {
            Init();
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dr">DataRow</param>
        public SubDivision(DataRow dr)
        {
            Init();
            SetModel(dr);
        }
        /// <summary>
        /// Constructed Function
        /// </summary>
        /// <param name="dt">DataTable</param>
        public SubDivision(DataTable dt)
        {
            Init();
            SetModel(dt);
        }
        #endregion --New--

        #region --Private--
        /// <summary>
        /// Init The Private variable
        /// </summary>
        private void Init()
        {
            _recid = 0;
            _divid = string.Empty;
            _subdivid = string.Empty;
            _shortdivname = string.Empty;
            _divname = string.Empty;
            _parentid = string.Empty;
            _path = string.Empty;
            _title = string.Empty;
            _email = string.Empty;
            _phone = string.Empty;
            _contact = string.Empty;
        }
        /// <summary>
        /// SetModel By DataRow
        /// </summary>
        /// <param name="dr">DataRow</param>
        /// <returns>SubDivision</returns>
        private SubDivision SetModel(DataRow dr)
        {
            _recid = StrHelper.GetIntValue(dr[FIELD_RecID]);
            _divid = StrHelper.GetStringValue(dr[FIELD_DivID]);
            _subdivid = StrHelper.GetStringValue(dr[FIELD_SubDivID]);
            _shortdivname = StrHelper.GetStringValue(dr[FIELD_ShortDivName]);
            _divname = StrHelper.GetStringValue(dr[FIELD_DivName]);
            _parentid = StrHelper.GetStringValue(dr[FIELD_ParentID]);
            _path = StrHelper.GetStringValue(dr[FIELD_Path]);
            _title = StrHelper.GetStringValue(dr[FIELD_Title]);
            _email = StrHelper.GetStringValue(dr[FIELD_Email]);
            _phone = StrHelper.GetStringValue(dr[FIELD_Phone]);
            _contact = StrHelper.GetStringValue(dr[FIELD_Contact]);
            return this;
        }
        /// <summary>
        /// SetModel By DataTable
        /// </summary>
        /// <param name="dt">DataTable</param>
        /// <returns>SubDivision</returns>
        private SubDivision SetModel(DataTable dt)
        {
            foreach (DataRow dr in dt.Rows)
            {
                SetModel(dr);
                break;
            }
            return this;
        }
        #endregion --Private--

    }
}

